{ //新建相册-beg
  function createList() {
    var uldom = document.querySelector(".left > ul");
    var liList = uldom.children;

    var liName = prompt("请输入相册名称：", "默认")
    try {
      if (liName != null && liName != "") {
        for (var i = 0; i < liList.length; i++) {
          if (liName === liList[i].querySelector("a").innerHTML) {
            throw "输入名称已存在，请重新输入。";
          }
        }
        var lidom = document.querySelector(".left > ul > li");
        uldom.insertAdjacentHTML('beforeEnd', lidom.outerHTML);
        var newlidom = uldom.lastChild;
        newlidom.querySelector("a").innerHTML = liName;
      }
    } catch (e) {
      alert("提示：" + e);
    }
  }
} //新建相册-end


{ //更改文本-beg
  function changeText(id) {
    var adom = document.querySelector("#title1");
    adom.innerHTML = id.innerHTML;
  }
} //更改文本-end

{
  function changeTab(id) {
    var aList = document.querySelector(".container > nav").getElementsByTagName('a');
    for (var i = 0; i < aList.length; i++) {
      aList[i].classList.remove("selectTab");
    }

    id.classList.add("selectTab");

    var contDom = document.querySelector(".container > .content");
    var titleDom = document.querySelector(".container > .title");
    var pDom = document.querySelector(".container > p");
    if (id.getAttribute("id") === "tab3") {
      contDom.classList.add("open");
      titleDom.classList.add("active");
      pDom.classList.add("inactive");
    } else {
      contDom.classList.remove("open");
      titleDom.classList.remove("active");
      pDom.classList.remove("inactive");
    }
  }
}

{
  function createElement(htmltext) {
    const container = document.createElement("div");
    container.innerHTML = htmltext;
    return container.firstElementChild;
  }
}
